﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.models.world.vos.areas {
    import flash.geom.*;
    import net.wooga.pets.models.world.vos.*;
    import __AS3__.vec.*;
    import net.wooga.pets.models.*;
    import net.wooga.pets.interfaces.*;
    import net.wooga.pets.constants.*;
    import net.wooga.pets.utils.*;

    public class AbstractAreaVO implements IArea {

        private var _actors:DictStorage;
        private var _elements:DictStorage;
        private var _id:String;
        private var _type:String;
        private var _maxZ:int;// = -1
        private var _contract:ContractVO;
        private var _viewRectangle:Rectangle;

        public function AbstractAreaVO(_arg1:Object){
            this._actors = new DictStorage();
            this._elements = new DictStorage();
            super();
            this._id = _arg1[ProtocolConstants.ID];
            this._type = _arg1[ProtocolConstants.ROOM_TYPE];
        }
        public function get id():String{
            return (this._id);
        }
        public function get type():String{
            return (this._type);
        }
        public function addActor(_arg1:IActing):void{
            this._actors.set(_arg1.id, _arg1);
        }
        public function getActor(_arg1:String):IActing{
            return ((this._actors.get(_arg1) as IActing));
        }
        public function get patientsIdList():Vector.<String>{
            var _local5:String;
            var _local6:Boolean;
            var _local1:Array = this._actors.keys;
            var _local2:int = _local1.length;
            var _local3:Vector.<String> = new Vector.<String>();
            var _local4:int;
            while (_local4 < _local2) {
                _local5 = _local1[_local4];
                _local6 = (this.getActor(_local5) is ITreatable);
                ((_local6) && (_local3.push(_local5)));
                _local4++;
            };
            _local3.fixed = true;
            return (_local3);
        }
        public function get babyIdList():Vector.<String>{
            var _local5:String;
            var _local6:Boolean;
            var _local1:Array = this._actors.keys;
            var _local2:int = _local1.length;
            var _local3:Vector.<String> = new Vector.<String>();
            var _local4:int;
            while (_local4 < _local2) {
                _local5 = _local1[_local4];
                _local6 = (this.getActor(_local5) is IBaby);
                ((_local6) && (_local3.push(_local5)));
                _local4++;
            };
            _local3.fixed = true;
            return (_local3);
        }
        public function removeActor(_arg1:String):IActing{
            return ((this._actors.remove(_arg1) as IActing));
        }
        public function addElement(_arg1:ElementVO):void{
            this._elements.set(_arg1.id, _arg1);
        }
        public function getElement(_arg1:String):ElementVO{
            return ((this._elements.get(_arg1) as ElementVO));
        }
        public function removeElement(_arg1:String):ElementVO{
            return ((this._elements.remove(_arg1) as ElementVO));
        }
        public function get maxZ():int{
            return (this._maxZ);
        }
        public function set maxZ(_arg1:int):void{
            this._maxZ = _arg1;
        }
        public function get nextMaxZ():int{
            return (++this._maxZ);
        }
        public function get elements():Array{
            return (this._elements.values);
        }
        public function removeBackgroundOf(_arg1:String):ElementVO{
            var _local2:Array = Arrays.findAllByAttribute(this.elements, "destination", _arg1);
            var _local3:ElementVO = (Arrays.extractByAttribute(_local2, "isBackground", true) as ElementVO);
            if (_local3){
                this._elements.remove(_local3.id);
            };
            return (_local3);
        }
        public function destroy():void{
        }
        public function get contract():ContractVO{
            return (this._contract);
        }
        public function set contract(_arg1:ContractVO):void{
            this._contract = _arg1;
        }
        public function set viewRectangle(_arg1:Rectangle):void{
            this._viewRectangle = _arg1;
        }
        public function get viewRectangle():Rectangle{
            return (this._viewRectangle);
        }

    }
}//package net.wooga.pets.models.world.vos.areas 
